package com.hellobike.haxing.modules.wms.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hellobike.haxing.modules.wms.entity.DeliveryOrderDetail;
import com.hellobike.haxing.modules.wms.mapper.DeliveryOrderDetailMapper;
import com.hellobike.haxing.modules.wms.service.IDeliveryOrderDetailService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: t_wms_delivery_order_detail
 * @Author: haxing-boot
 * @Date:   2020-01-14
 * @Version: V1.0
 */
@Service
public class DeliveryOrderDetailServiceImpl extends ServiceImpl<DeliveryOrderDetailMapper, DeliveryOrderDetail> implements IDeliveryOrderDetailService {

    @Override
    public List<DeliveryOrderDetail> getByHeaderId(Long deliveryHeaderId) {
        DeliveryOrderDetail q = new DeliveryOrderDetail();
        q.setOrderHeaderId(deliveryHeaderId);
        Wrapper<DeliveryOrderDetail> wrapper = new QueryWrapper<>(q);
        return baseMapper.selectList(wrapper);
    }

    @Override
    public DeliveryOrderDetail getByHeaderIdAndBarcode(Long deliveryHeaderId, String barcode) {
        DeliveryOrderDetail q = new DeliveryOrderDetail();
        q.setOrderHeaderId(deliveryHeaderId);
        q.setBarcode(barcode);
        Wrapper<DeliveryOrderDetail> wrapper = new QueryWrapper<>(q);
        return baseMapper.selectOne(wrapper);
    }
}
